Skip to content

Refactor extension build process to use modular build steps#6867

Open
alfonso-noriega wants to merge 1 commit into01-build-steps-infrastructurefrom
02-wire-build-config-into-extension-specs
Open

Refactor extension build process to use modular build steps#6867
alfonso-noriega wants to merge 1 commit into01-build-steps-infrastructurefrom
02-wire-build-config-into-extension-specs

Conversation

@alfonso-noriega
Copy link
Contributor

WHY are these changes introduced?

Fixes #0000

WHAT is this pull request doing?

How to test your changes?

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

alfonso-noriega commented Feb 19, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@alfonso-noriega alfonso-noriega changed the title Abstract build steps to externalize the build configuration Refactor extension build process to use modular build steps Feb 19, 2026
@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch from 64d581f to c4c3353 Compare February 19, 2026 13:05
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from 1c5c718 to 3ac919f Compare February 19, 2026 13:05
@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch from c4c3353 to d2a2b21 Compare February 19, 2026 13:05
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch 2 times, most recently from 2b6f7ba to 68c2a9f Compare February 19, 2026 13:20
@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch from d2a2b21 to 3837d71 Compare February 19, 2026 13:27
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch 2 times, most recently from 8096aa6 to f6ae0a0 Compare February 19, 2026 13:36
@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch 2 times, most recently from 794d3e0 to 75deab1 Compare February 19, 2026 13:53
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from f6ae0a0 to 1b503e0 Compare February 19, 2026 13:53
@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch from 75deab1 to feab6d2 Compare February 19, 2026 14:20
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from 1b503e0 to 01cfc8b Compare February 19, 2026 14:20
@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch from feab6d2 to 27b8cfc Compare February 19, 2026 14:33
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from 01cfc8b to 048e70a Compare February 19, 2026 14:33
@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch from 27b8cfc to 34005f5 Compare February 19, 2026 15:31
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from 048e70a to c25acc0 Compare February 19, 2026 15:31
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch 5 times, most recently from 4dd6917 to 56f0d4a Compare February 20, 2026 12:51
@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2026

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 78.94% 14634/18539
🟡 Branches 73.19% 7273/9937
🟡 Functions 79.16% 3714/4692
🟡 Lines 79.28% 13837/17453

Test suite run success

3851 tests passing in 1492 suites.

Report generated by 🧪jest coverage report action from 61f4d35

@alfonso-noriega alfonso-noriega marked this pull request as ready for review February 20, 2026 13:10
@alfonso-noriega alfonso-noriega requested a review from a team as a code owner February 20, 2026 13:10
identifier: HostedAppHomeSpecIdentifier,
buildConfig: {mode: 'hosted_app_home'} as const,
buildConfig: {mode: 'none'} as const,
schema: HostedAppHomeSchema,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hosted app home build is effectively disabled (behavior change)

The PR changes hosted_app_home from buildConfig: {mode: 'hosted_app_home'} to {mode: 'none'}. Previously, ExtensionInstance.build() had a hosted_app_home branch that called copyStaticAssets(). After this refactor, mode: 'none' produces steps = [], so no build-time actions happen for hosted app home extensions.

Evidence (new behavior):

  • ExtensionInstance.build() now does: const steps = buildConfig.mode === 'none' ? [] : buildConfig.steps and runs only those steps.
  • HostedAppHome spec now sets mode: 'none', so nothing runs.

Impact: Hosted app home extensions can ship without static assets being copied into the build output. End users (merchants) could see missing UI/resources; deployments may succeed but produce broken runtime behavior. This affects all users of that extension type.

@binks-code-reviewer
Copy link

binks-code-reviewer bot commented Feb 27, 2026

🤖 Code Review · #projects-dev-ai for questions
React with 👍/👎 or reply — all feedback helps improve the agent.

Complete - No issues

📋 History

✅ 1 findings → ✅ 1 findings → ✅ 2 findings → ✅ No issues

@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch from ef0c29e to 644b571 Compare March 4, 2026 13:13
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from 61f4d35 to 8b922b5 Compare March 4, 2026 13:13
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/private/node/conf-store.d.ts
@@ -21,8 +21,6 @@ interface Cache {
 export interface ConfSchema {
     sessionStore: string;
     currentSessionId?: string;
-    devSessionStore?: string;
-    currentDevSessionId?: string;
     cache?: Cache;
 }
 /**
packages/cli-kit/dist/private/node/testing/ui.d.ts
@@ -73,8 +73,7 @@ export declare function sendInputAndWait(renderInstance: ReturnType<typeof rende
 export declare function sendInputAndWaitForContent(renderInstance: ReturnType<typeof render>, content: string, ...inputs: string[]): Promise<void>;
 /** Function that is useful when you want to check the last frame of a component that unmounted.
  *
- * With Ink 6 / React 19, the output is no longer cleared on unmount,
- * so lastFrame() consistently returns the last rendered content.
+ * The reason this function exists is that in CI Ink will clear the last frame on unmount.
  */
 export declare function getLastFrameAfterUnmount(renderInstance: ReturnType<typeof render>): string | undefined;
 type TrackedPromise<T> = Promise<T> & {
packages/cli-kit/dist/private/node/ui/components/SelectInput.d.ts
@@ -1,5 +1,8 @@
 import React from 'react';
 import { DOMElement } from 'ink';
+declare module 'react' {
+    function forwardRef<T, TProps>(render: (props: TProps, ref: React.Ref<T>) => React.ReactElement | null): (props: TProps & React.RefAttributes<T>) => React.ReactElement | null;
+}
 export interface SelectInputProps<T> {
     items: Item<T>[];
     initialItems?: Item<T>[];
@@ -15,8 +18,7 @@ export interface SelectInputProps<T> {
     morePagesMessage?: string;
     availableLines?: number;
     onSubmit?: (item: Item<T>) => void;
-    inputFixedAreaRef?: React.Ref<DOMElement>;
-    ref?: React.Ref<DOMElement>;
+    inputFixedAreaRef?: React.RefObject<DOMElement>;
     groupOrder?: string[];
 }
 export interface Item<T> {
@@ -27,5 +29,4 @@ export interface Item<T> {
     helperText?: string;
     disabled?: boolean;
 }
-declare function SelectInput<T>({ items: rawItems, initialItems, onChange, enableShortcuts, focus, emptyMessage, defaultValue, highlightedTerm, loading, errorMessage, hasMorePages, morePagesMessage, availableLines, onSubmit, inputFixedAreaRef, ref, groupOrder, }: SelectInputProps<T>): React.ReactElement | null;
-export { SelectInput };
\ No newline at end of file
+export declare const SelectInput: <T>(props: SelectInputProps<T> & React.RefAttributes<DOMElement>) => React.ReactElement | null;
\ No newline at end of file


if (!result.success && !step.continueOnError) {
throw new Error(`Build step "${step.displayName}" failed: ${result.error?.message}`)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate/double-wrapped error handling in ExtensionInstance.build()

executeStep() already throws when a step fails and continueOnError is false:

throw new Error(`Build step "${step.displayName}" failed: ${stepError.message}`)

But ExtensionInstance.build() then checks:

if (!result.success && !step.continueOnError) {
  throw new Error(`Build step "${step.displayName}" failed: ${result.error?.message}`)
}

That condition is effectively unreachable because executeStep() won’t return {success:false} unless continueOnError is true. This is dead logic and also risks producing a worse error message (e.g., undefined) if behavior changes later.

Impact:

  • User impact: Confusing/duplicated error messaging during builds; harder debugging.
  • Infra impact: No direct outage risk, but increases operational toil.

@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch from 644b571 to d9664fc Compare March 4, 2026 15:14
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from 8b922b5 to 38a9028 Compare March 4, 2026 15:14
import {bundleThemeExtension, copyFilesForExtension} from '../../services/extensions/bundle.js'
import {ExtensionBuildOptions, bundleFunctionExtension} from '../../services/build/extension.js'
import {bundleThemeExtension} from '../../services/extensions/bundle.js'
import {BuildContext, executeStep} from '../../services/build/build-steps.js'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import target for build steps points to non-existent module (runtime crash)

ExtensionInstance imports BuildContext/executeStep from ../../services/build/build-steps.js, but that file does not exist in the repo. The actual implementation is packages/app/src/cli/services/build/client-steps.ts, which exports executeStep and BuildContext. This will fail Node ESM module resolution at runtime, breaking any command path that loads extension-instance.ts (build, deploy, etc.).

context.stepResults.set(step.id, result)

if (!result.success && !step.continueOnError) {
throw new Error(`Build step "${step.displayName}" failed: ${result.error?.message}`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step shape mismatch: executor expects name, configs/build loop use displayName

The build loop references step.displayName for error messages, while the executor (client-steps.ts) expects a ClientStep with name and logs using step.name. Updated step specs appear to use displayName rather than name, which can result in logs like Executing step: undefined and unreliable routing/error reporting. If TypeScript is strictly enforced, this should fail typechecking; otherwise it degrades observability and debugging.

@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from 38a9028 to a5303fd Compare March 4, 2026 16:01
@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch 2 times, most recently from 1fa9fa8 to 174ca57 Compare March 4, 2026 16:12
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from a5303fd to 0945d47 Compare March 4, 2026 16:12
@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch from 174ca57 to 9964055 Compare March 4, 2026 16:16
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from 0945d47 to c468483 Compare March 4, 2026 16:16
@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch from 9964055 to d835caf Compare March 4, 2026 16:22
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from c468483 to 067c371 Compare March 4, 2026 16:22
@alfonso-noriega alfonso-noriega changed the base branch from 01-build-steps-infrastructure to graphite-base/6867 March 4, 2026 16:29
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from 067c371 to be84850 Compare March 4, 2026 16:32
@alfonso-noriega alfonso-noriega changed the base branch from graphite-base/6867 to 01-build-steps-infrastructure March 4, 2026 16:32
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from be84850 to dd1d204 Compare March 4, 2026 16:38
@alfonso-noriega alfonso-noriega force-pushed the 01-build-steps-infrastructure branch from 57a0790 to 316c2ab Compare March 4, 2026 16:38
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch 4 times, most recently from 785afb4 to a7efd5b Compare March 4, 2026 17:33
@alfonso-noriega alfonso-noriega force-pushed the 02-wire-build-config-into-extension-specs branch from a7efd5b to e90a1b3 Compare March 4, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant